package main

import (
	"diaomao/route"

	"github.com/gin-gonic/gin"
	"github.com/spf13/viper"
)

func main() {
	engine := gin.Default()

	engine.LoadHTMLGlob("templates/**/*")
	// var templateFile []string
	// filepath.Walk("./templates", func(path string, info os.FileInfo, err error) error {
	// 	if strings.HasSuffix(path, ".html") {

	// 		templateFile = append(templateFile, path)
	// 	}
	// 	return nil
	// })
	// fmt.Println(templateFile)
	// engine.LoadHTMLFiles(templateFile...)

	route.NewInitializeRouter(&engine.RouterGroup).Run()

	//engine.Static("/storage", "./assets")

	viper.SetConfigFile("./config/dev.yml")
	if err := viper.ReadInConfig(); err != nil {
		panic("配置文件错误")
	}

	engine.Run()
}
